<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:sg="http://java.sun.com/jsf/composite/ezcomp"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <h:outputStylesheet library="css" name="Main.css" />
        <h:outputStylesheet library="css" name="Form.css" />
        <h:outputStylesheet library="css" name="TopMenu.css" />
        <h:outputStylesheet library="css" name="Footer.css" />
        <h:outputStylesheet library="css" name="Chart.css" />
        <h:outputStylesheet library="css" name="tipsy.css" />
        <h:outputStylesheet library="css" name="jquery-ui-1.8.14.custom.css" />
        <h:outputScript library="javascript" name="jquery.prettyPhoto.js" />
        <h:outputScript library="javascript" name="jQuery.js" />
        <h:outputScript library="javascript" name="jquery.tipsy.js" />
        <h:outputScript library="javascript" name="jQueryUi.js" />
        <h:outputScript library="javascript" name="jQueryUiWidget.js" />
        <h:outputScript library="javascript" name="Stats.js" />
        <h:outputScript library="javascript" name="json2.js" />
        <h:outputScript library="javascript" name="MyJs.js" />

        <title>Conta de <h:outputText value="#{contaBackingBean.userName}" /></title>
    </h:head>
    <h:body>
        <sg:pageHeader >
            <ui:param name="menu" value="true" />
        </sg:pageHeader>
        <h2>Contratos associados a este Facebook</h2>
        <h:form>
            <div class="frameContent">
                <div class="frameleft">
                    <h3>Lista de contratos:</h3>
                    <h:selectOneListbox styleClass="ContractList" value="#{contaBackingBean.selectedContract}" title="Selecione um contrato para visualizar a respectiva informação">
                        <f:selectItems value="#{contaBackingBean.contractList}" />
                        <f:ajax event="change" render="contractInfo" />
                    </h:selectOneListbox><br />

                </div>

                <h:panelGroup id="contractInfo" styleClass="frameright">
                    <div class="framerightVerticalLine"></div>
                    <h3>Informação do contrato:</h3> 
                    <ul>
                        <li>
                            <b>Número do Contrato: </b> <h:outputText value="#{contaBackingBean.contractNumber}" />
                        </li>
                        <li>
                            <b>Fornecedor: </b> <h:outputText value="#{contaBackingBean.contractSupplier}" />
                        </li>
                        <li>
                            <b>Tarifa Actual: </b> <h:outputText value="#{contaBackingBean.contractTarif}" />
                        </li>
                        <li>
                            <b>Nome do Cliente: </b> <h:outputText value="#{contaBackingBean.contractName}" />
                        </li>
                        <li>
                            <b>Nif do Cliente: </b> <h:outputText value="#{contaBackingBean.contractNif}" />
                        </li>
                    </ul>
                </h:panelGroup>
            </div>
            <div class="frameContent">
                <h3>Adicionar novo contrato:</h3>
                <div id="container">
            <h:form id="contractform" styleClass="formS">
                <div id="focus">
                    <fieldset>
                        <div class="fm-opt">
                            <label><h:outputText value="Fornecedor"/></label>
                            <h:selectOneMenu id="supplierCombo" value="#{contaBackingBean.selectedSupplier}" title="Seleccionar o fornecedor de energia.">
                                <f:selectItems value="#{contaBackingBean.suppliersList}" />
                            </h:selectOneMenu>
                        </div>
                        <div class="fm-opt">
                            <label><h:outputText value="Número de Contrato"/></label>
                            <h:inputText id="contract" value="#{contaBackingBean.contract}" title="Inserir número de contracto com o fornecedor de energia." />
                            <h:message styleClass="error" id="contractError" for="contract" />
                        </div>

                        <div class="fm-opt">
                            <label class="label"><h:outputText value="Número de Contribuinte" /></label>
                            <h:inputText id="nif" value="#{contaBackingBean.nif}" title="Inserir número de identificação fiscal do titular do contrato com o fornecedor de energia." />
                            <h:message styleClass="error" id="nifError" for="nif" />
                        </div>
                    </fieldset>
                </div>
                <div id="fm-submit">
                    <h:commandButton id="SubmitButton" value="Submeter" action="#{contaBackingBean.submit()}" title="Clique para prosseguir" />
                </div>
            </h:form>
        </div>
            </div>
        </h:form>

        <sg:pageFooter />

    </h:body>
</html>

